package cn.ftx.controller;


import cn.ftx.model.*;
import cn.ftx.service.FangtianxiaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author AUTHER
 * @since 2021-04-29
 */
@RestController
@RequestMapping("/ftx/fangtianxia")
@Api(value = "API信息", description = "API信息", protocols = "application/json")
@CrossOrigin //所有域名均可访问该类下所有接口
public class FangtianxiaController {

    @Autowired
    private FangtianxiaService fangtianxiaService;

    @ApiOperation(value = "测试 #AUTHER 2021-04-29#", notes = "测试", nickname = "FangtianxiaController-testMethod")
    @RequestMapping(value = "edit_article", method = RequestMethod.GET)
    Boolean testMethod(){
        return Boolean.TRUE;
    }

    @ApiOperation(value = "滚动展示最新记录 #AUTHER 2021-04-29#", notes = "滚动展示最新记录", nickname = "FangtianxiaController-queryHouseList")
    @ApiImplicitParam(name = "number",value = "数量",paramType = "query",dataType = "int",required = true)
    @RequestMapping(value = "query_house_list", method = RequestMethod.GET)
    List<FangtianxiaDTO> queryHouseList(@RequestParam(value = "number") Integer number){
       return fangtianxiaService.queryHouseList(number);
    }

    @ApiOperation(value = "户型（type）饼图 #AUTHER 2021-04-29#", notes = "户型（type）饼图", nickname = "FangtianxiaController-queryHouseTypeRatio")
    @RequestMapping(value = "query_house_type_ratio", method = RequestMethod.GET)
    List<HouseTypeVO> queryHouseTypeRatio(){
        return fangtianxiaService.queryHouseTypeRatio();
    }

    @ApiOperation(value = "根据rank（等级）饼图 #AUTHER 2021-04-29#", notes = "根据rank（等级）饼图", nickname = "FangtianxiaController-queryHouseRankRatio")
    @RequestMapping(value = "query_house_rank_ratio", method = RequestMethod.GET)
    List<HouseRankVO> queryHouseRankRatio(){
        return fangtianxiaService.queryHouseRankRatio();
    }

    @ApiOperation(value = "查询所有面积 #AUTHER 2021-04-29#", notes = "查询所有面积", nickname = "FangtianxiaController-queryHouseAreaList")
    @RequestMapping(value = "query_house_area_list", method = RequestMethod.GET)
    List<Double> queryHouseAreaList(){
        return fangtianxiaService.queryHouseAreaList();
    }

    @ApiOperation(value = "查询所有面积对应的价格 #AUTHER 2021-04-29#", notes = "查询所有面积对应的价格", nickname = "FangtianxiaController-queryHouseAreaPriceList")
    @RequestMapping(value = "query_house_area_price_list", method = RequestMethod.GET)
    List<HouseAreaPriceVO> queryHouseAreaPriceList(){
        return fangtianxiaService.queryHouseAreaPriceList();
    }

    @ApiOperation(value = "查询所有年份 #AUTHER 2021-04-29#", notes = "查询所有年份", nickname = "FangtianxiaController-queryHouseYearList")
    @RequestMapping(value = "query_house_year_list", method = RequestMethod.GET)
    List<String> queryHouseYearList(){
        return fangtianxiaService.queryHouseYearList();
    }

    @ApiOperation(value = "查询所有年份以及该年份均价 #AUTHER 2021-04-29#", notes = "查询所有年份以及该年份均价", nickname = "FangtianxiaController-queryYearPriceList")
    @RequestMapping(value = "query_year_price_list", method = RequestMethod.GET)
    List<HouseYearPriceVO> queryYearPriceList(){
        return fangtianxiaService.queryYearPriceList();
    }

    @ApiOperation(value = "各年份最热门户型 #AUTHER 2021-04-29#", notes = "各年份最热门户型", nickname = "FangtianxiaController-queryYearTypeList")
    @RequestMapping(value = "query_year_type_list", method = RequestMethod.GET)
    List<HouseYearTypeVO> queryYearTypeList(){
        return fangtianxiaService.queryYearTypeList();
    }

    @ApiOperation(value = "各个户型年份均价变化 #AUTHER 2021-04-29#", notes = "各个户型年份均价变化", nickname = "FangtianxiaController-queryTypePriceList")
    @RequestMapping(value = "query_type_price_list", method = RequestMethod.GET)
    HouseTypePriceVO queryTypePriceList(){
        return fangtianxiaService.queryTypePriceList();
    }
}

